Skip to main content

Lex Customer Contract Import

Introduction

This will import Lex vehicles in to ViSN

download sample Lex customer contract import file.

File format

Comma Separated Values - *.csv
Encoding - UTF-8

Lex Customer Customers Import

Column PositionLex Customer contract fieldsDescriptionMax lengthData TypeRulesMandatoryExample
CRegistrationVehicle Registration number10StringA-Z & 0-9 CharactersYAH23KJH
DAsset NumberAsset Number20StringA-Z & 0-9N88 AX29-UE39
EScheme Data RefScheme Data Ref10StringA-Z 0-9 and Special CharactersNSALCA2AN9MH8#90904
FCAPIDCap Id20StringA-Z 0-9 and Special CharactersNQW82JK764HSN
GMakeMake of the vehicle20StringA-Z 0-9 and Special CharactersNFord
HModelModel of the vehicle100StringA-Z 0-9 and Special CharactersNEscape
IDerivativevariant100StringA-Z 0-9 and Special CharactersNManual transmission
JColourColour of Vehicle100StringA-Z 0-9 and Special CharactersNPearl White
KRegistration DateRegistration DateNADateDD/MM/YYYYN30/10/2024
LContract Start Date Start date of contractNADateDD/MM/YYYYN30/10/2024
MContract End DateEnd date of contractNADateDD/MM/YYYYN30/10/2024
OFuel TypeFuel type of vehicle1StringEither X, P, U, D, ONP
RContract Mileage TermMileage of Vehicle6Number0-9N33448
SVINChassis Number20StringA-Z 0-9NSALCA2AN9MH890904
TDriver NameDriver first name50StringA-Z 0-9 and Special CharactersNAndre
UDriver NumberContact Telephone115Number0-9N23821828
UDriver Mobile NumberContact Telephone215Number0-9N23821828
XAuthority NotesAuthority Notes150StringA-Z 0-9 and Special CharactersNTestTest
YDriver EmailContact Email50StringStandard email formatNdriver@email.com
ABDeletedOnly "Maintained" vehicles are imported, if the value is other than N, then it is ignored and a log is added
NAStringY or NNY
ACCustomer Account NumberCustomer Account Number100StringA-Z 0-9 and Special CharactersNXW442TYW
AHMOT Due dateLast date for MOTNADateDD/MM/YYYYN30/10/2024
AIRFL Renewal DateRFL Renewal DateNADateDD/MM/YYYYN30/10/2024
AJWarranty Expiry DateWarranty Expiry DateNADateDD/MM/YYYYN30/10/2024
AJWarranty Parameter MileageWarranty mileage6Number0-9N223445
AOService Program Included FlagService Program Included Flag15BooleanY or NNY
APService Program TextService Program Text15StringA-Z 0-9 and Special CharactersNTest

Importing a File

Preparation

  1. Create a new branch including the Jira task number in the branch name.
  2. Delete all files in the importFiles folder.
  3. Create a folder with the current sprint number.
  4. Copy the file that needs to be imported to the created folder.
  5. Update package.json:
    • Locate the line for validate:lexCustomerContract.
    • Update --leaseId with the required lease ID.
    • Update --file with the relative path of the file.
  6. Save package.json.

Local Validation

  1. In a terminal, run npm run build.
  2. Run the validation script: npm run validate:lexCustomerContract.
  3. If validation passes without errors, push the code.

Workflow Validation

  1. Navigate to Actions in the Import Manager.
  2. Locate <Environment> - on-demand-import.
  3. Select the branch created for this import.
  4. Enter the script name as validate:lexCustomerContract.
  5. Leave the Overrides field empty.

Importing the File

  1. If the validation passes, proceed with the import.
  2. Navigate to Actions in the Import Manager.
  3. Locate <Environment> - on-demand-import.
  4. Select the branch created for this import.
  5. Enter the script name as import:lexCustomerContract.
  6. Enter --persist in the Overrides field.

Importing the File via Cloud Run

Creating Schedulers for Lex Customer Contract Validation

  1. Go to Cloud Scheduler and select CREATE JOB.

Scheduler Setup

Configure a Cloud Scheduler with the following parameters:

  • Name: lex_customer_contract_import_file_validation
  • Region: europe-west2
  • Frequency: 0 0 31 12 1
  • Time Zone: British Summer Time (BST)
  • Target Type: HTTP
  • URL: https://import-manager-36r2bu4izq-uc.a.run.app/lex-customer-contract
  • HTTP Method: POST
  • Auth Header: Select OIDC Token
  • Service Account: cloud-run-import-customer-contract
  • Body: Include the following JSON object:
{
"leaseId": "QJKgdjS4I02sEia4yTne",
"leaseCompanyName": "Next Fleet Services",
"persist": "false",
"bucket": "biddirect-2.appspot.com",
"appDirectory": "/usr/src/app/",
"importPath": "imports/fileDrop/",
"importFileDropPath": "imports/fileDrop/",
"importFileName": "lexCustomerContract.csv",
"email": "mailgun@digitalinnk.com",
"fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
"schema": "LEX_CUSTOMER_CONTRACT"
}

Lex Customer Contract Scheduler Setup

This guide explains how to create Cloud Schedulers for validating and importing Lex customer contracts.

Creating Schedulers for Validating the Lex Customer Contract

Steps to Create Scheduler for Importing Lex Customer Contract

  1. Go to Cloud Scheduler.
  2. Select CREATE JOB.

Required Setup

Configure the Cloud Scheduler with the following parameters:

  • Name: lex_customer_contract_file_import
  • Region: europe-west2
  • Frequency: 0 0 31 12 1
  • TimeZone: GMT London
  • Target type: HTTP
  • URL: https://import-manager-36r2bu4izq-uc.a.run.app/lex-customer-contract
  • HTTP method: POST
  • Auth header: Select OIDC token
  • Service account: cloud-run-import-customer-contract
  • Body: JSON object with the following parameters:
{
"leaseId": "QJKgdjS4I02sEia4yTne",
"leaseCompanyName": "Next Fleet Services",
"persist": "true",
"bucket": "biddirect-2.appspot.com",
"appDirectory": "/usr/src/app/",
"importPath": "imports/fileDrop/",
"importFileDropPath": "imports/fileDrop/",
"importFileName": "lexCustomerContract.csv",
"email": "mailgun@digitalinnk.com",
"fatalErrorEmailToAddress": "mailgun@digitalinnk.com",
"schema": "LEX_CUSTOMER_CONTRACT"
}

Lex Customer Contract Import Scheduler

This guide covers the steps to create and configure Cloud Schedulers for importing and validating Lex customer contracts.

Creating Scheduler for Importing Lex Customer Contract

Preparation

  1. Bucket Name: biddirect-2.appspot.com (bucket name may vary across environments).
  2. File Path: The file should be placed in imports/fileDrop within the bucket, using the CSV file named lexCustomerContract. Uploading to this path will place the file in the specified location within the designated bucket.

Validation

  1. Go to Cloud Scheduler.
  2. Run the lex_customer_contract_import_file_validation job (job name may vary in different environments).

Importing

  1. Go to Cloud Scheduler.
  2. Run the lex_customer_contract_file_import job (job name may vary in different environments).

Testing

  1. After running the import, verify that Lex vehicles have been successfully imported by navigating to the ViSN customer platform.
  2. Go to Vehicle Record and search for the imported vehicle to confirm the import process was successful.
Status: Accepted
Category: Protected
Authored By: Jeyakumar Arunagiri on Oct 30, 2024
Revisions